package com.gxa.meiye.admin.shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.meiye.admin.shop.mapper.OrderManagementMapper;
import com.gxa.meiye.admin.shop.service.OrderManagementService;
import com.gxa.meiye.core.pojo.shopManagement.OrderManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author cc
 * @PackageName meiye
 * @Package com.gxa.meiye.admin.shop.service.impl
 * @Date 2022/7/24 9:52
 * @Version 1.0
 */
@Service
public class OrderManagementServiceImpl extends ServiceImpl<OrderManagementMapper,OrderManagement> implements OrderManagementService {
    @Autowired
    private OrderManagementMapper orderManagementMapper;
    @Override
    public List<OrderManagement> getAll() {
        List<OrderManagement> orderManagements = orderManagementMapper.selectAll();
        return orderManagements;
    }

    @Override
    public Integer getAllCount() {
        Integer count = orderManagementMapper.selectAllCount();
        return count;
    }

    @Override
    public List<OrderManagement> getByCondition(Integer pageNum, Integer pageSize, String endTime,  String orderNumber,  String phone,  String startTime, Integer status) {
        return orderManagementMapper.queryByCondition(pageNum,pageSize,endTime,orderNumber,phone,startTime,status);
    }

    @Override
    public Integer conditionAll(OrderManagement orderManagement) {
        return orderManagementMapper.countConditionAll(orderManagement);
    }

    @Override
    public Integer deleteOrder(Integer status) {
        if(status==3){
            return orderManagementMapper.deleteByStatus(status);
        }else {
            return 0;
        }

    }


}

